/*******************************************************************************
 * Copyright (c) 2006 CEA LIST.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA LIST - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.activitydiagram.tabbedproperties.section;

import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.CallBehaviorAction;
import org.eclipse.uml2.uml.NamedElement;

import com.cea.papyrus.core.filters.BehaviorFilter;
import com.cea.papyrus.core.tabbedproperties.AbstractSelectionElementSection;

/**
 * display called behavior 
 */
public class CallBehaviorActionSection extends AbstractSelectionElementSection {


	public CallBehaviorActionSection() {
		super("called Behavior", new BehaviorFilter());
	}

	@Override
	public NamedElement getReferencedElementToDisplay() {
		return((CallBehaviorAction)umlElement).getBehavior();
	}

	@Override
	public void removeReferencedElement() {
		((CallBehaviorAction)getElement()).setBehavior(null);
	}

	@Override
	public void setReferencedElement(NamedElement element) {
		if (element instanceof Behavior){
			Behavior selectedBehavior = (Behavior)element; 
			if(selectedBehavior!= null){
				((CallBehaviorAction)getElement()).setBehavior(selectedBehavior);
			}
		}
		
	}
}